<?php

/**
 * This is the model class for table "{{exam}}".
 *
 * The followings are the available columns in table '{{exam}}':
 * @property double $exam_id
 * @property string $exam_name
 * @property string $exam_term_name
 * @property string $exam_term
 * @property double $exam_start_time
 * @property double $exam_end_time
 * @property string $exam_subject_ids
 * @property double $exam_edu_type
 * @property double $exam_edu_grade
 * @property double $exam_edu_class
 * @property double $exam_status
 * @property double $exam_num
 * @property double $time_created
 * @property double $exam_subject_type
 * @property double $exam_studentrule
 * @property double $exam_teacherrule
 * @property double $exam_pointrule
 * @property double $exam_outpointrule
 * @property double $create_user
 * @property double $create_time
 * @property double $update_user
 * @property double $update_time
 * @property string $exam_comment
 * @property double $is_del
 */
class Exam extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return Exam the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return '{{exam}}';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('exam_start_time, exam_end_time, exam_edu_type, exam_edu_grade, exam_edu_class, exam_status, exam_num, time_created, exam_subject_type, exam_studentrule, exam_teacherrule, exam_pointrule, exam_outpointrule, create_user, create_time, update_user, update_time, is_del', 'numerical'),
			array('exam_name', 'length', 'max'=>255),
			array('exam_term_name', 'length', 'max'=>255),
			array('exam_term', 'length', 'max'=>32),
			array('exam_subject_ids', 'length', 'max'=>255),
			array('exam_comment', 'length', 'max'=>4000),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('exam_id, exam_name, exam_term_name, exam_term, exam_start_time, exam_end_time, exam_subject_ids, exam_edu_type, exam_edu_grade, exam_edu_class, exam_status, exam_num, time_created, exam_subject_type, exam_studentrule, exam_teacherrule, exam_pointrule, exam_outpointrule, create_user, create_time, update_user, update_time, exam_comment, is_del', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'exam_id' => 'Exam',
			'exam_name' => 'Exam Name',
			'exam_term_name' => 'Exam Term Name',
			'exam_term' => 'Exam Term',
			'exam_start_time' => 'Exam Start Time',
			'exam_end_time' => 'Exam End Time',
			'exam_subject_ids' => 'Exam Subject Ids',
			'exam_edu_type' => 'Exam Edu Type',
			'exam_edu_grade' => 'Exam Edu Grade',
			'exam_edu_class' => 'Exam Edu Class',
			'exam_status' => 'Exam Status',
			'exam_num' => 'Exam Num',
			'time_created' => 'Time Created',
			'exam_subject_type' => 'Exam Subject Type',
			'exam_studentrule' => 'Exam Studentrule',
			'exam_teacherrule' => 'Exam Teacherrule',
			'exam_pointrule' => 'Exam Pointrule',
			'exam_outpointrule' => 'Exam Outpointrule',
			'create_user' => 'Create User',
			'create_time' => 'Create Time',
			'update_user' => 'Update User',
			'update_time' => 'Update Time',
			'exam_comment' => 'Exam Comment',
			'is_del' => 'Is Del',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('exam_id',$this->exam_id);
		$criteria->compare('exam_name',$this->exam_name,true);
		$criteria->compare('exam_term_name',$this->exam_term_name,true);
		$criteria->compare('exam_term',$this->exam_term,true);
		$criteria->compare('exam_start_time',$this->exam_start_time);
		$criteria->compare('exam_end_time',$this->exam_end_time);
		$criteria->compare('exam_subject_ids',$this->exam_subject_ids,true);
		$criteria->compare('exam_edu_type',$this->exam_edu_type);
		$criteria->compare('exam_edu_grade',$this->exam_edu_grade);
		$criteria->compare('exam_edu_class',$this->exam_edu_class);
		$criteria->compare('exam_status',$this->exam_status);
		$criteria->compare('exam_num',$this->exam_num);
		$criteria->compare('time_created',$this->time_created);
		$criteria->compare('exam_subject_type',$this->exam_subject_type);
		$criteria->compare('exam_studentrule',$this->exam_studentrule);
		$criteria->compare('exam_teacherrule',$this->exam_teacherrule);
		$criteria->compare('exam_pointrule',$this->exam_pointrule);
		$criteria->compare('exam_outpointrule',$this->exam_outpointrule);
		$criteria->compare('create_user',$this->create_user);
		$criteria->compare('create_time',$this->create_time);
		$criteria->compare('update_user',$this->update_user);
		$criteria->compare('update_time',$this->update_time);
		$criteria->compare('exam_comment',$this->exam_comment,true);
		$criteria->compare('is_del',$this->is_del);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}